#!/usr/bin/env python3
# -*-coding : utf-8 -*-
# @time     : 2019/9/22 0022 下午 4:44
# @Author   : Administrator
# @FileName : requests模块的使用.py
# --------------------------------------------------------

"""
requests模块的使用
"""

# 爬取搜狗首页的页面数据
import requests

# 1.指定url
url = "https://www.sogou.com/"
# 2.发起请求
response = requests.get(url=url)
# 3.获取响应数据
page_text = response.text  # text返回的是字符串类型的数据
print(page_text)
# 4.持久化存储
with open("./sogou.html", 'w', encoding='utf8') as f:
    f.write(page_text)
